<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>记账系统 - 显示详情</title>
<!--[if lt IE 9]>
  <script src="libs/html5shiv.min.js"></script>
  <script src="libs/respond.min.js"></script>
  <![endif]-->
<script src="libs/jquery-1.12.1.min.js"></script>
<link href="libs/bootstrap-3.3.6/css/bootstrap.min.css" rel="stylesheet">
<script src="libs/bootstrap-3.3.6/js/bootstrap.min.js"></script>
<script src="libs/getQueryString.js"></script>
<script type="text/javascript" src="libs/handlebars.min.js"></script>
</head>
<body>
	<div class="container">
		<div class="row">
			<div class="col-md-12 page-header">
				<h2 class="text-center">
					记账<br />
					<small>显示详情</small>
				</h2>
			</div>
		</div>
	</div>
	<div class="container">
		<div class="row">
			<div class="col-md-8">
				<ul class="nav nav-pills">
					<li><a href="#">用户： <span id="text3"></span>
					</a></li>
					<li><a href="index.html">首页</a></li>
					<li><a href="xjsr.html">新加收入</a></li>
					<li><a href="xjzc.html">新加支出</a></li>
					<li><a href="month.html">当月统计</a></li>
					<li><a href="queryall.html">查询</a></li>
					<li class="active"><a href="querydes.html">查询详情</a></li>
				</ul>

				<div class="container">
					<div class="row">
						<div class="col-md-5">
							<hr />
						</div>
					</div>
				</div>
			</div>
		</div>

		<div class="col-md-12">
			<div class="panel panel-success">
				<div class="panel-heading">
					<center>查询结果</center>
				</div>
				<div class="panel-body" id="list1"></div>
			</div>
		</div>
		<div class="col-md-12">
			<button id="querydel" class="btn btn-primary btn-block">删除</button>
		</div>



		<script id="template" type="text/x-handlebars-template">
   {{#each item}}
 	 <div class="panel panel-default col-md-3" >
   	  <div class="panel-body">
    	   <dl>
  			 <dt>ID</dt><dd>{{id}}</dd>
             <dt>UID</dt><dd>{{user_id}}</dd>
    	     <dt>时间</dt><dd>{{date_time}}</dd>
     	  	 <dt>地点</dt><dd>{{place}}</dd>
     	   	 <dt>收入</dt><dd>{{money_in}}</dd>
     	  	 <dt>支出</dt><dd>{{money_out}}</dd>
		  	 <dt>类别</dt><dd>{{kind}}</dd>
			 <dt>备注</dt><dd>{{remark}}</dd>
			
      	   </dl>  
        </div>
      </div>
   {{/each}}
</script>
		<script type="text/javascript">
			$(function() {
				var id = getQueryString('id');
				$.getJSON('querydes.action?id=' + id, function(res) {
					var data = {
						'item' : res
					};
					var t = Handlebars.compile($('#template').html());
					$('#list1').html(t(data));
				});
				$('#querydel').click(function() {
					$.post('querydel.action', {
						id : id
					}, function(res, status) {
						if ('OK' == res) {
							alert('删除成功');
							window.location.href = 'index.html';
						}
					})
				});

				$.getJSON('query_nickname.action', function(res) {
					console.log(res);
					$('#text3').text(res.nickname);

				});
			});
		</script>
</body>
</html>
